import java.util.Arrays;

public class Job02 {
    public static void main(String[] args) {
        int[] S = {10,20,11,35,6,89};
        int ByAsc = 0;
        int ByDesc = 0;
        System.out.println("排序前:" + Arrays.toString(S));
        for (int i = 0; i < S.length - 1; i++) {
            for (int j = 0; j < S.length - 1 - i; j++) {//小到大
                if (S[j] > S[j+1]){
                    ByAsc = S[j];
                    S[j] = S[j+1];
                    S[j+1] = ByAsc;
                }
            }
            for (int j = 0; j < S.length - 1 - i; j++) {//大到小
                if (S[j] < S[j+1]){
                    ByDesc = S[j];
                    S[j] = S[j+1];
                    S[j+1] = ByDesc;
                }
            }
        }
        Arrays.sort(S);
        System.out.println("排序后:" + Arrays.toString(S));
    }
}
